<?php
namespace common\widgets;

use Yii;
use yii\base\Widget;

class Block extends Widget
{
    /**
     * $type
     * replace 替换 
     * insert 插入 
     * append 追加
     */
    public $type; 


    public function init()
    {
        ob_start();
        ob_implicit_flush(false);
    }

    public function run()
    {
        $block = ob_get_clean();
        $blockId = $this->getId();
        $this->view->injectBlock($blockId, $block, $this->type);
        /*$this->view->blocks[$blockId][] = [
            'type' => $this->type,
            'content' => $block,
            'level' => $level
        ];*/
    }
}
